package zoo.member.admin.pro.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import zoo.member.admin.pro.dao.AdminProductDao;
import zoo.member.admin.pro.domain.AdminProductCommand;
import zoo.member.admin.util.StringUtil;

@Controller
public class AdminProductDetailController {
	private static Log log = LogFactory.getLog(AdminProductDetailController.class);
	@Autowired
	private AdminProductDao apDao;
	
	@RequestMapping("/admin/detailList.do")
	public ModelAndView process(@RequestParam("p_code")int p_code){
		if(log.isDebugEnabled()){
			log.debug("p_code : " + p_code);
		}
		
		AdminProductCommand board = apDao.selectProBoard(p_code);

		//줄바꿈 처리
		board.setP_content(StringUtil.parseBr(board.getP_content()));
		
		return new ModelAndView("prodetail","board",board);	
		
	}	
}
